#!/bin/bash

xcode-select --install
sudo date

echo '********** get a couple of projects from github **********'
mkdir ~/Projects
cd ~/Projects
git clone https://github.com/RehabMan/HP-ProBook-4x30s-DSDT-Patch probook.git

echo '********** install some more tools and all the kexts that are required... **********'
cd ~/Projects/probook.git
./download.sh
./install_downloads.sh

echo '********** hibernation (suspend to disk or S4 sleep) is not supported on hackintosh, disable it **********'
sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage
sudo mkdir /var/vm/sleepimage
echo '********** NOTICE: always check hibernatemode after updates and disable it **********'

echo '********** ACPI configuration **********'
cd ~/Projects/probook.git
./build.sh
./mount_efi.sh
./install_acpi.sh install_4x0g5_kabylake-r

echo '********** Final config.plist **********'
cd ~/Projects/probook.git
./mount_efi.sh
cp ./config/config_4x0_G5_Kabylake-R.plist ./config/config_440_G5_Kabylake-R-no-framebuffer-patch-1080p.plist
sed -i '' '/framebuffer-patch-enable/{N;d;}' ./config/config_440_G5_Kabylake-R-no-framebuffer-patch-1080p.plist
sed -i '' 's/1024x768/1920x1080/' ./config/config_440_G5_Kabylake-R-no-framebuffer-patch-1080p.plist
cp ./config/config_440_G5_Kabylake-R-no-framebuffer-patch-1080p.plist /Volumes/EFI/EFI/Clover/config.plist

